package ${package.Convertor};

import com.song.tools.mvc.convertor.AggregationConvertor;
import ${package.Bo}.${BoName};
import ${package.Query}.${QueryName};
import ${package.ImportDto}.${ImportDtoName};
import ${package.ExportDto}.${ExportDtoName};
import ${package.QueryRequest}.${QueryRequestName};
import ${package.SaveRequest}.${SaveRequestName};
import ${package.UpdateRequest}.${UpdateRequestName};
import ${package.QueryResponse}.${QueryResponseName};
import ${package.SaveResponse}.${SaveResponseName};
import ${package.UpdateResponse}.${UpdateResponseName};
import ${package.Entity}.${EntityName};
import org.mapstruct.AfterMapping;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;

import java.util.List;

/**
 * <p>
 * ${table.comment!} 转换器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public abstract class ${ConvertorName} implements AggregationConvertor<${EntityName}, ${BoName}, ${QueryName}, ${QueryRequestName}, ${QueryResponseName},
        ${SaveRequestName}, ${SaveResponseName}, ${UpdateRequestName}, ${UpdateResponseName}, ${ImportDtoName}, ${ExportDtoName}> {

    @Override
    public abstract ${EntityName} entityBoToEntity(${BoName} ${entityLowerCaseFirstOne}Bo);

    @Override
    public abstract ${BoName} entityToEntityBo(${EntityName} ${entityLowerCaseFirstOne});

    @Override
    public abstract ${QueryResponseName} entityBoToQueryResponse(${BoName} ${entityLowerCaseFirstOne}Bo);

    @Override
    public abstract ${QueryName} queryRequestToQuery(${QueryRequestName} queryRequest);

    @Override
    public abstract ${BoName} saveRequestToEntityBo(${SaveRequestName} request);

    @Override
    public abstract ${SaveResponseName} entityBoToSaveResponse(${BoName} ${entityLowerCaseFirstOne}Bo);

    @Override
    public abstract ${BoName} updateRequestToEntityBo(${UpdateRequestName} request);

    @Override
    public abstract ${UpdateResponseName} entityBoToUpdateResponse(${BoName} ${entityLowerCaseFirstOne}Bo);

    @Override
    public abstract List<${EntityName}> entityBoToEntity(List<${BoName}> entityBo);

    @Override
    public abstract List<${BoName}> entityToEntityBo(List<${EntityName}> entity);

    @Override
    public abstract ${ExportDtoName} entityBoToExportDto(${BoName} entityBo);

    @Override
    public abstract ${BoName} importDtoToEntityBo(${ImportDtoName} importDto);

    @Override
    public abstract List<${BoName}> importDtoToEntityBo(List<${ImportDtoName}> importDto);


    @AfterMapping
    public void afterMappingEntityBoToEntity(@MappingTarget ${EntityName} ${entityLowerCaseFirstOne}, ${BoName} ${entityLowerCaseFirstOne}Bo) {
        // entityBoToEntity() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToEntity()
    }

    @AfterMapping
    public void afterMappingEntityToEntityBo(@MappingTarget ${BoName} ${entityLowerCaseFirstOne}Bo, ${EntityName} ${entityLowerCaseFirstOne}) {
        // entityToEntityBo() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityToEntityBo()
    }

    @AfterMapping
    public void afterMappingQueryRequestToQuery(@MappingTarget ${QueryName} ${entityLowerCaseFirstOne}Query, ${QueryRequestName} ${entityLowerCaseFirstOne}QueryRequest) {
        // queryRequestToQuery() 内部其它代码执行完之后，最后会自动执行 afterMappingQueryRequestToQuery()
    }

    @AfterMapping
    public void afterMappingEntityBoToQueryResponse(@MappingTarget ${QueryResponseName} ${entityLowerCaseFirstOne}QueryResponse, ${BoName} ${entityLowerCaseFirstOne}Bo) {
        // entityBoToQueryResponse() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToQueryResponse()
    }

    @AfterMapping
    public void afterMappingEntityBoToSaveResponse(@MappingTarget ${SaveResponseName} ${entityLowerCaseFirstOne}SaveResponse, ${BoName} ${entityLowerCaseFirstOne}Bo) {
        // entityBoToSaveResponse() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToSaveResponse()
    }

    @AfterMapping
    public void afterMappingSaveRequestToEntityBo(@MappingTarget ${BoName} ${entityLowerCaseFirstOne}Bo, ${SaveRequestName} ${entityLowerCaseFirstOne}SaveRequest) {
        // saveRequestToEntityBo() 内部其它代码执行完之后，最后会自动执行 afterMappingSaveRequestToEntityBo()
    }

    @AfterMapping
    public void afterMappingEntityBoToUpdateResponse(@MappingTarget ${UpdateResponseName} ${entityLowerCaseFirstOne}UpdateResponse, ${BoName} ${entityLowerCaseFirstOne}Bo) {
        // entityBoToUpdateResponse() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToUpdateResponse()
    }

    @AfterMapping
    public void afterMappingUpdateRequestToEntityBo(@MappingTarget ${BoName} ${entityLowerCaseFirstOne}Bo, ${UpdateRequestName} ${entityLowerCaseFirstOne}UpdateRequest) {
        // updateRequestToEntityBo() 内部其它代码执行完之后，最后会自动执行 afterMappingUpdateRequestToEntityBo()
    }

    @AfterMapping
    public void afterMappingImportDtoToEntityBo(@MappingTarget ${BoName} ${entityLowerCaseFirstOne}Bo, ${ImportDtoName} ${entityLowerCaseFirstOne}ImportDto) {
        // importDtoToEntityBo() 内部其它代码执行完之后，最后会自动执行 afterMappingImportDtoToEntityBo()
    }

    @AfterMapping
    public void afterMappingEntityBoToExportDto(@MappingTarget ${ExportDtoName} ${entityLowerCaseFirstOne}ExportDto, ${BoName} ${entityLowerCaseFirstOne}Bo) {
        // entityBoToExportDto() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToExportDto()
    }
}
